<!--
 * @FilePath     : /study_code/vue2.x/component-component.html
 * @Description  : component 内置组件使用
 * @Date         : 2025-05-02 17:53:55
 * @Author       : Fang YingGui
 * @LastEditors  : fangyinggui 18715384437@163.com
 * @LastEditTime : 2025-05-02 17:53:55
-->
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>documentName</title>
    <link rel="stylesheet" href="" />
  </head>
  <body>
    <div id="app">
      <component :is="currentTabComponent"></component>
      <button v-on:click="changeTab">切换组件</button>
    </div>

    <script src="/vue/dist/vue.min.js"></script>
    <script src="./common.js"></script>
    <script>
      let lotutPatent = {
        template: '<p>组件-专利页</p>',
      }
      let lotutBrand = {
        template: '<p>组件-商标页</p>',
      }

      var vm = new Vue({
        el: '#app',
        data: function () {
          return {
            currentTabComponent: lotutPatent,
          }
        },
        components: { lotutPatent, lotutBrand },
        methods: {
          changeTab() {
            this.currentTabComponent === lotutPatent
              ? (this.currentTabComponent = lotutBrand)
              : (this.currentTabComponent = lotutPatent)
          },
        },
      })
    </script>
  </body>
</html>
